package javaAdvanced;

import java.io.*;

/**
 * 我的类加载器
 *
 * @author cuiH
 * Date: 13-12-6
 */
public class MyClassLoader {
    public static void main(String[] args) throws IOException {
        String srcPath = args[0];
        String destPath = args[1];
        FileInputStream fileInputStream = new FileInputStream(srcPath);
        FileOutputStream fileOutputStream = new FileOutputStream(destPath);
        cypher(fileInputStream,fileOutputStream);
        fileInputStream.close();
        fileOutputStream.close();
    }


    /**
     * 一个简单的加密算法,加解密同一个（异或一下）
     * @throws IOException
     */
    private static void cypher(InputStream inputStream,OutputStream outputStream) throws IOException {
        int b =  -1;
        while ((b= inputStream.read())!=-1){
            outputStream.write(b^0xff);
        }
    }
}
